home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_class_mine.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  84 lines

  1. # Jones 3D Cog Script
  2. #
  3. # class_Mine.cog
  4. #
  5. # Mine explodes when touched.
  6. #
  7. # [RT]
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     
  14.     message        touched
  15.  
  16.     template    tplExplode=+uw_blast    local
  17.     template    tplBubble=+bubbles        local
  18.     template    tplGhost=ghost            local
  19.  
  20. #    template    x=+uw_spr_blast            local
  21. #    template    y=+uw_spr_explode        local
  22.  
  23.     thing        mine                    local
  24.     thing        ghost                    local
  25.     thing        bubble                    local
  26.  
  27.     int            i                        local
  28.  
  29.     vector        bubbleVel                local
  30.  
  31. end
  32.  
  33. # ........................................................................................
  34.  
  35. code
  36.  
  37. touched:
  38.  
  39.     if (GetSourceRef() != GetLocalPlayerThing()) return;
  40.  
  41.     mine = GetSenderRef();
  42.  
  43.     ghost = CreateThing(tplGhost, mine);
  44.     DestroyThing(mine);
  45.  
  46.     CreateThing(tplExplode, ghost);
  47.  
  48.     Sleep(0.25);
  49.  
  50.     for (i = 0; i < 100; i = i + 1)
  51.     {
  52.         # Make a bubble
  53.         bubble = CreateThing(tplBubble, ghost);
  54.  
  55.         # Set the life left to a random value
  56.         SetLifeLeft(bubble, Rand() * 20.0);
  57.  
  58.         # Set it to die when it hits air
  59.         SetThingFlags(bubble, 0x10000000);
  60.  
  61.         # Animate the bubble sprite
  62.         AnimateSpriteSize(bubble, '0.001 0.001 1.0', '0.06 0.06 1.0', 0.5);
  63.  
  64.         # Set the bubble to a random velocity
  65.         bubbleVel = VectorSet(Rand() - 0.35, Rand() - 0.35, Rand() + 0.5);
  66.         bubbleVel = VectorScale(bubbleVel, 0.4);
  67.         if (Rand() < 0.5)
  68.         {
  69.             bubbleVel = VectorSet(-VectorX(bubbleVel), VectorY(bubbleVel), VectorZ(bubbleVel));
  70.         }
  71.         if (Rand() < 0.5)
  72.         {
  73.             bubbleVel = VectorSet(VectorX(bubbleVel), -VectorY(bubbleVel), VectorZ(bubbleVel));
  74.         }
  75.         SetThingVel(bubble, bubbleVel);
  76.     }
  77.  
  78.     DestroyThing(ghost);
  79.  
  80.     return;
  81.  
  82. end
  83.  
  84.